//----------------------------------*-C++-*----------------------------------//
/*!
 * \file   IsotropicSource.hh
 * \author Jeremy Roberts
 * \date   05/23/2011
 * \brief  IsotropicSource member definitions.
 * \note   Copyright (C) Jeremy Roberts
 */
//---------------------------------------------------------------------------//
// $Rev::                                               $:Rev of last commit
// $Author::                                            $:Author of last commit
// $Date::                                              $:Date of last commit
//---------------------------------------------------------------------------//

#ifndef ISOTROPICSOURCE_HH
#define ISOTROPICSOURCE_HH

#include <vector>

#include "BaseSource.hh"
#include "../utilities/SP.hh"

namespace slabtran
{

//===========================================================================//
/*!
 * \class IsotropicSource
 * \brief Derived source defining an isotropic external source at each
 *        fine mesh.
 *
 *        The source is defined explicitly by mesh and group, with the
 *        strength given volumetrically, i.e. particles/cm^3-sec.
 *        Construction can be helped via use of coarse mesh definitions.
 *
 *        \todo Implement me!
 *
 */
//===========================================================================//

class IsotropicSource : public BaseSource
{

public:
  //@{
  //! Useful typedefs for classes that use IsotropicSource
  typedef util::SP<IsotropicSource> SP_source;
  typedef Base_Mesh::SP_mesh        SP_mesh;
  typedef Cell_Field<double>        Source_Field;
  typedef typename Octant<D>::Omega Omega;
  //@}

  // Constructor.
  explicit IsotropicSource(SP_mesh mesh, int number_groups);

  // >>> DERIVED INTERFACE

  //! Return the number of groups.
  int num_groups() const
  {
    return d_number_groups;
  }

  // Get source in particles/cm^3.
  inline double q_e(const int cell, const Omega &angle, const int g) const;

  // Get source in particles/cm^3.
  inline double q_e(const int i, const int j, const int k, const Omega &angle, const int g) const;

  // Verify that the sources have been assigned.
  bool verify() const;

  // >>> CLASS INTERFACE

  // Set the source for a group
  void set(const int g, const Source_Field &source);

private:
  // >>> DATA

  // Number of cells
  const int d_number_cells;

  // Number of groups
  const int d_number_groups;

  // Source strength in particles/cm^3 in each cell in each group
  std::vector<Source_Field> d_source;

};

} // end namespace slabtran

#endif // ISOTROPICSOURCE_HH

//---------------------------------------------------------------------------//
//              end of IsotropicSource.hh
//---------------------------------------------------------------------------//
